<% # @page_title="Port Information" %>
<% @table = @port_infos %>
<% @select_portinfo = 1 %>
<% @action = "index" %>
<% @cont = "port_infos" %>


<%
if @url_params[:host_id_v].nil?
  @mselect_portinfo=1
end
%>

<%= render :partial => 'layouts/page_count' %>

<table>
<thead>
  <tr>
    <th scope="col">
      <%= sort_link("Test Area", "session_test_area") %>
      <%= filterx_icon("Remove filter on #{session[:test_area]}", session[:test_area], :test_area, {:controller => 'test_areas', :action => 'set', :id => 'all'}) %>
    </th>

    <th scope="col"><%= sort_link("Host", "ip_address") %>
      <%= filterx_icon("Remove filter on host", @url_params[:host_id_v], :host_id_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Port", "port") %>
      <%= filterx_icon("Remove filter on port #{@url_params[:port_v]}", @url_params[:port_v], :port_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Trans", "transport_protocol") %>
      <%= filterx_icon("Remove filter on #{@url_params[:trans_v]}", @url_params[:trans_v], :trans_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Key Name", "key") %>
      <%= filterx_icon("Remove filter on #{@url_params[:key_v]}", @url_params[:key_v], :key_v, {:controller => @cont}) %>
    </th>

    <th scope="col"><%= sort_link("Value", "value") %>
      <%= filterx_icon("Remove filter on #{@url_params[:value_v]}", @url_params[:value_v], :value_v, {:controller => @cont}) %>
    </th>
  </tr>
</thead>

<tbody>
<%
odd_or_even = 0
for port_info in @port_infos
    odd_or_even = 1 - odd_or_even
    # <td><= link_to port_info.ip_address, port_info.host ></td>
%>
  <tr class="odd<%=h odd_or_even %>">
    <td><%=h port_info.test_area_name %>
        <%= filter_icon("Show only #{port_info.test_area_name}", session[:test_area], {:controller => 'test_areas', :action => 'set', :id => port_info.test_area_id}) %>
    </td>

    <td><%=link_to_host(port_info.ip_address, {:controller => "port_infos", :host_id_v => port_info.host_id}) %>
        <%= filter_icon("Show only #{port_info.ip_address}", @url_params[:host_id_v], {:controller => 'port_infos', :host_id_v => port_info.host_id}) %>
	<%= www_link_icon(port_info) %>
    </td>

    <td><%=h port_info.port.port %>
        <%= filter_icon("Show only port #{port_info.port.port}", @url_params[:port_v], {:controller => 'port_infos', :port_v => port_info.port.port}) %> </td>

    <td><%=h port_info.transport_protocol %>
        <%= filter_icon("Show only #{port_info.transport_protocol} ports", @url_params[:trans_v], {:controller => 'port_infos', :trans_v => port_info.transport_protocol}) %>
    </td>

    <td><%=h port_info.port_info_key %>
        <%= filter_icon("Show only #{port_info.port_info_key} keys", @url_params[:key_v], {:controller => 'port_infos', :key_v => port_info.port_info_key}) %>
    </td>

    <td><%=h yt_truncate(port_info.value,100) %>
         <%= filter_icon("Show only this value", @url_params[:value_v], {:controller => 'port_infos', :value_v => port_info.value}) %>
    </td>
  </tr>
<% end %>
</tbody>
</table>

<%= render :partial => 'layouts/page_count' %>
